﻿using System.Collections.Generic;
using System.Windows.Forms;
using Gp.Scripts.Core;
using Gp.Scripts.Data;
using UnityEditor;
using UnityEngine;
using UnityEngine.SceneManagement;

namespace GP.Scripts.City {
    public class SpawnPlace : MonoBehaviour {
        public bool isSpecial = false;
        public float Radius;
        private List<UnitPrefabEntityConfig> presets = new List<UnitPrefabEntityConfig>();

        public void SpawnCreature(CreatureConfig config) {
            if(config == null) return;
            
            var str = "";
            foreach (var configCreatureInfo in config.CreatureInfos)
            {
                str += configCreatureInfo + "\n";
            }
            Debug.Log(str);
        }

#if UNITY_EDITOR
        
        // private void OnEnable() {
        //     SceneView.duringSceneGui += OnSceneGUI;
        // }
        //
        // private void OnDisable() {
        //     SceneView.duringSceneGui -= OnSceneGUI;
        // }
        //
        // private void OnSceneGUI(SceneView obj) {
        //     
        // }
        
        private void OnDrawGizmos()
            {
                // 设置Handles的颜色
                Handles.color = Color.green;

                // 在生成点位置绘制一个圆盘
                Handles.DrawWireDisc(transform.position, Vector3.up, Radius);

                // 在高度0.2米的位置绘制一个圆盘
                Handles.DrawWireDisc(transform.position + Vector3.up * 0.3f, Vector3.up, Radius);
                // 设置Gizmos的颜色
                if (!isSpecial) {
                    Gizmos.color = Color.green;
                }
                else {
                    Gizmos.color = Color.yellow;
                }

                Gizmos.DrawCube(transform.position, Vector3.one / 3);
            }
#endif
    }
}